package com.AIDS.AIDSweeper.server.model.DAO;

import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;

import com.AIDS.AIDSweeper.server.model.Game;
import com.AIDS.AIDSweeper.server.model.Gamer;
import com.google.appengine.api.datastore.Key;

public class GamerDAO extends GoogleJDODAO<Gamer, Key> {
	
	@SuppressWarnings("unchecked")
	public List<Gamer> findByStatus(String status, PersistenceManager pm) {
		Query q = pm.newQuery(Gamer.class);
		q.setFilter("status == statusParam");
		q.declareParameters("String statusParam");
		return (List<Gamer>)q.execute(status);
	}
	
	public List<Gamer> findByGame(Key gameKey, PersistenceManager pm) {
		Game game = DAOFactory.instance().getGameDAO().findById(gameKey, pm);
		return game.getGamers();
	}
}
